﻿using System;
using System.Collections.Generic;
using System.Text;

namespace designmodule.structuralmodule.Composite
{
    class program
    {
        void main()
        {
            var root = new Composite("root");

            root.Add(new Leaf("leaf A"));
            root.Add(new Leaf("leaf B"));

            var comp = new Composite("Comp X");
            comp.Add(new Leaf("Leaf XA"));
            comp.Add(new Leaf("Leaf XB"));

            root.Add(comp);

            var comp2 = new Composite("Comp XY");
            comp2.Add(new Leaf("Leaf XYA"));
            comp2.Add(new Leaf("Leaf XYB"));

            comp.Add(comp2);

            root.Add(new Leaf("Leaf C"));

            var leaf = new Leaf("Leaf D");

            root.Add(leaf);
            root.Remove(leaf);

            root.Display(1);

        }
    }
}
